﻿@inject NavigationManager NavManager

<div class="jumbotron">
    <h1 class="display-4 text-center">Welcome to Blazing Trails</h1>
    <p class="lead text-center">Find the most beautiful hiking trails using our blazing fast search!</p>
    <p class="mt-4">
        <input @onkeydown="SearchForTrail"
               @bind="_searchTerm"
               @bind:event="oninput"
               type="text"
               placeholder="Search for a trail..."
               class="form-control form-control-lg" />
    </p>
</div>

@code {
    private string _searchTerm = "";

    private void SearchForTrail(KeyboardEventArgs args)
    {
        if (args.Key != "Enter") return;

        NavManager.NavigateTo($"/search/{_searchTerm}");
    }
}
